using System;

namespace Admin.Net.Plugin.Api;

public class CheckMeterDto
{
	/// <summary>
	/// 当前
	/// </summary>
	public decimal NowValue { get; set; }

	/// <summary>
	/// 上次
	/// </summary>
	public decimal LastValue { get; set; }

	/// <summary>
	/// 钱
	/// </summary>
	public decimal Amount { get; set; }

	/// <summary>
	/// 当前co2
	/// </summary>
	public decimal NowCo2 => Math.Round(NowValue * 0.997m / 1000m, 2);

	/// <summary>
	/// 上次co2
	/// </summary>
	public decimal LastCo2 => Math.Round(LastValue * 0.997m / 1000m, 2);

	/// <summary>
	/// 率
	/// </summary>
	public string Rate
	{
		get
		{
			if (LastValue == 0m)
			{
				return 0.0 + "%";
			}
			return Math.Round((NowValue - LastValue) / LastValue * 100m, 2) + "%";
		}
	}
}
